<template>
	<!--#ifndef MP-WEIXIN -->
	<view class="img">
		<image src="http://img.qincore.cn/2021/07/26/374d8d92bdeff.jpg" mode=""></image>

		<view class="view_1">
			<view class="">
				<text>账号：</text>
				<input @input="onKeyInput" focus='true' type="text" value="" placeholder="账号/手机号" placeholder-style="color:#a3a3a3"/>
			</view>
			<view class="">
				<text>密码：</text>
				<input @input="onKeyInput1" type="text" value="" placeholder="password" placeholder-style="color:#a3a3a3"/>
			</view>
		</view>
	
		<view class="view_2">
			<button id="btn_1" type="mini" plain="true" @click="login">登录</button>
			<button id="btn_2" type="mini" plain="true">注册</button>
		</view>
	</view>
	<!--#endif-->
</template>

<script>
	export default{
		//#ifndef MP-WEIXIN
		data(){
			return{
				inputValue:'',
				inputValue1:''
			}
		},
		// #endif
		methods:{
			//#ifndef MP-WEIXIN
			onKeyInput: function(event) {
			            this.inputValue = event.target.value
			      },
					onKeyInput1: function(event) {
					            this.inputValue1 = event.target.value
					        },
			login(){
			console.log(this.inputValue,this.inputValue1)
				this.$ajax({
					url:'/denglu/long',
					data:{
						userwoer:this.inputValue,
						password:this.inputValue1
					}
				}).then((res)=>{
					console.log(res)
					if(res.data.error==0){
						uni.switchTab({
							url:'/pages/Home/home'
						})
					}
					console.log(res)
				}).catch((err)=>{
					// console.log(err)
				})
			},
			// #endif
			rpai(){
				uni.login({
				  success: function (res) {
					  console.log(res)
				  let ff=res.code;
					if (res.code) {
					      //发起网络请求
					      uni.request({
					        url: 'https://api.weixin.qq.com/sns/jscode2session',
					        data: {
								appid:'wxf5110bdc08798fdb',
								secret:'fb76af094c91763c4c5f1dda88e74b32',
								js_code:res.code,
								grant_type:'authorization_code'
					        },
							success:function(res){
								console.log(res)
								uni.request({
									url:'http://172.17.26.211:8090/user/onlogin',
									data:{
										code:ff,
										password:'18222222222',
										phone:'123456',
									},
									success:function(res){
										console.log(555555,res)
									}
								})
							}
						})
					}
				  }
				});
			}
		},
		
		// #ifdef MP-WEIXIN
		onLoad(){
			uni.switchTab({
				url:'/pages/Home/home'
			})
		},
		// #endif
	}
</script>

<style lang="less">
	 /*#ifndef MP-WEIXIN*/
	.img {
		width: 750rpx;
		height: 100%;
		position: relative;

		image {
			width: 1500rpx;
			height: 1620rpx;
		}
	}

	.view_1 {
		width: 600rpx;
		height: 300rpx;
		position: absolute;
		top: 700rpx;
		left: 150rpx;
		view{
			margin: 40rpx 50rpx;
			color: #FFFFFF;
		}
		input{
			display: inline-block;
			vertical-align: middle;
			font-size: 28rpx;
			padding-left: 30rpx;
			border-bottom: 1px solid #333333;
		}
		
	}
	.view_2{
		display: flex;
		position: absolute;
		top: 1000rpx;
		left: 285rpx;
		#btn_1{
			margin-right: 20rpx;
			width: 150rpx;
			height: 80rpx;
			line-height: 80rpx;
			font-size: 30rpx;
		}
		#btn_2{
			margin-right: 20rpx;
			width: 150rpx;
			height: 80rpx;
			line-height: 80rpx;
			font-size: 30rpx;
		}
	}
	/* #endif*/
</style>